package com.service.Impl;

import com.dao.RoleDao;
import com.pojo.Role;
import com.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service(value = "roleServiceImpl")
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleDao roleDao;

    public boolean doaddRoleService(Role role) {
        int row = roleDao.addRoleDao(role);
        if (row>0){
            return true;
        }else {
            return false;
        }
    }

    public boolean dodeleteRoleService(int id) {
        int row = roleDao.deleteRoleDao(id);
        if (row>0){
            return true;
        }else {
            return false;
        }
    }

    public boolean doupdateRoleService(Role role) {
        int row = roleDao.updateRoleDao(role);
        if (row>0){
            return true;
        }else {
            return false;
        }
    }

    public Role findRoleById(int id) {
        return roleDao.findRoleById(id);
    }

    public List<Role> findAll() {
        return roleDao.findAll();
    }
}
